This is length-sensitive extension to the filter-harmonize3. It enables to give also length patterns associated to three input melodies. len-harmonize3 has three outputs which must be bound to atoms using multiple-value-setq.
(multiple-value-setq (hmel1 hmel2 hmel3)
(len-harmonize3 mel1 len1 mel2 len2 mel3 len3
12
'1/1
(activate-tonality (harmonic-minor c 2))
'((4 4))
'((1 2 6 8 10 11))
'(0 5 7)))
Note that the zone controls how long the length patterns are to be run, and controls the recycling of the input patterns when necessary. Try with different zone lengths to get the effect. See len-harmonize2.
After harmonisation it is often needed to smooth out the output a bit with find-change and filter-deactivate. Also symbol-fold can be handy in keeping the material more consistent. These are needed mostly when you don't exactly know beforehand what the input melodies are, if they have lots of repeats, or are in wide range of symbols.
len-harmonize3 performs its operation with the aid of expand-with-len and compress-with-len. These functions can be useful in other purposes, too.
expand-with-len takes a symbol pattern, length pattern, zone length and the minimum length (minimum quantisation value). The result is a symbol pattern which is expanded using the rhythm to last the zone using the minimum length to determine the number of repeats of each symbol.
(expand-with-len '(a b c d) '(1/16. 1/8) '1/1 '1/32)
--> (a a a b b b b c c c d d d d a a a b b b b c c c d d d d a a a b b b b)
compress-with-len takes a symbol pattern, length pattern and minimum
length and picks up the right symbols that match the rhythm.
(compress-with-len (expand-with-len '(a b c d) '(1/16. 1/8) '1/1 '1/32)